Skip to content

Render snip descriptions as Markdown in the copy flyout#25

Merged
StuartMeeks merged 2 commits into
masterfrom
feat/markdown-descriptions
May 30, 2026
Merged

Render snip descriptions as Markdown in the copy flyout#25
StuartMeeks merged 2 commits into
masterfrom
feat/markdown-descriptions

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

What

Implements the Markdown rendering for Snip descriptions carried-over item. Descriptions were stored as plain text and never surfaced on the use-path; they now render as Markdown in the copy flyout.

Approach (Markdig in Core, per the agreed design)

There's no clean first-party markdown control for our WASDK 2.1 / net10 stack (the 7.x toolkit Markdown control risks conflicting with the 8.x toolkit; the newer Markdig-based control isn't shipped stable). So:

  • Core does the parsing. MarkdownParser (backed by Markdig, latest stable) walks the AST into a small UI-free model (MarkdownBlock/MarkdownInline — paragraphs, headings, code blocks, lists; runs with bold/italic/code flags, links, line breaks). This is unit-tested with no UI dependency, matching the Core/App discipline.
  • App does the rendering. MarkdownPresenter (a self-building StackPanel) maps the model onto native WinUI inlines/elements — Run/Hyperlink/LineBreak, monospace code, bordered code blocks, bulleted/numbered lists. No new UI dependency; Markdig flows transitively into the App via the Core project reference.

UX

  • The flyout shows the rendered description above the parameter inputs.
  • Behaviour change (flagged for review): a Snip with a description but no parameters now opens the flyout too (previously it copied instantly), so its description is actually visible before copying. Snips with neither parameters nor a description still copy directly. Easy to revert if you'd rather keep instant-copy.
  • The editor labels the field "Description (Markdown)" with a hint.

Tests

  • 11 MarkdownParserTests (blank input, paragraphs, bold/italic/inline-code flags, headings, fenced code, ordered/unordered lists, links, hard breaks).
  • 1 ShellViewModel test for the described-but-parameterless flyout behaviour.
  • Full suite green: 136 passing.
  • WinUI head compiles clean on the Windows build agent — 0 warnings, 0 errors.

🤖 Generated with Claude Code

StuartMeeks and others added 2 commits May 30, 2026 08:15
Snip descriptions were stored as plain text and never shown on the use-path.
Parse them as Markdown in Core (MarkdownParser, backed by Markdig) into a
UI-free block/inline model, and render that model to native WinUI inlines via
a MarkdownPresenter control in the copy flyout. Supports headings, bold/
italic, inline and block code, links, and ordered/unordered lists.

The parsing lives in Core so it's unit-tested without any UI dependency; the
App only maps the model onto WinUI primitives. A snip with a description but
no parameters now opens the flyout too, so its description is always visible
before copying. The editor labels the field as Markdown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Routing described-but-parameterless snips through the fill flyout regressed
copy for templates containing bare {token} text: with no declared parameters
the engine left the token unresolved and IsCopyEnabled stayed false, so the
snip could no longer be copied (the direct path had copied it verbatim).

Gate copy on full resolution only when there are parameters to fill; with
none, the template copies verbatim as before. Capture the parameter presence
in a field since a defaulted input fires its change callback during
construction, before Inputs is assigned.

Found by codex review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@StuartMeeks StuartMeeks merged commit 3eb1f7d into master May 30, 2026
4 checks passed
@StuartMeeks StuartMeeks deleted the feat/markdown-descriptions branch May 30, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant